package com.qs.rocketmq.bt.controller;

import com.qs.rocketmq.bt.base.SpringProducer;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/mqTest")
public class MqTestController {

    private static final String topic = "qs_bt_topic";

    @Resource
    private SpringProducer producer;

    /**
     * 测试发送消息
     * http://localhost:8092/mqTest/sendMessage?message=helloWorld
     */
    @RequestMapping("/sendMessage")
    public String sendMessage(String message){
        producer.sendMessage(topic, message);
        return "消息发送完成";
    }
}
